package com.alibaba.controller.htmlController;

import com.alibaba.bean.DailyList;
import com.alibaba.bean.DailyListData;
import com.alibaba.bean.NoteList;
import com.alibaba.service.NoteListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class DailyListController {

    @Autowired
    NoteListService noteListService;

    public ModelAndView noteList() {

        NoteList noteList = new NoteList();
        noteList.setFollow(false);
        noteList.setPage(1);
        noteList.setUserId(46);

//        DailyListData
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("article");

        DailyList dailyList =  (DailyList)(noteListService.getNoteList(noteList).getData());
        List<DailyListData> list =  dailyList.getDailyList();
        modelAndView.addObject("noteList", list);
        return modelAndView;
    }
}
